load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")

################################################################################
# Distribution files
############################################################################

genrule(
    name = "protoc-compat-gen",
    outs = ["protoc"],
    cmd = """
        PROTOC_BINARY_NAME="protoc-3.0.0-linux-x86_64.exe"
        if [ `uname` = "Darwin" ]; then
          PROTOC_BINARY_NAME="protoc-3.0.0-osx-x86_64.exe"
        fi
        wget https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0/$${PROTOC_BINARY_NAME} -O protoc
        chmod +x protoc
        mv protoc $@
    """,
    executable = True,
    visibility = ["//ruby/compatibility_tests/v3.0.0:__subpackages__"],
)

pkg_files(
    name = "dist_files",
    srcs = [
        "//ruby/compatibility_tests/v3.0.0/tests:dist_files",
        "BUILD.bazel",
        "Rakefile",
        "README.md",
        "test.sh",
    ],
    strip_prefix = strip_prefix.from_root(""),
    visibility = ["//pkg:__pkg__"],
)
